<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<head>
    <style type="text/css">
            .labelsAndValues-labelCell { background-color: #E0E690; padding-left: 5px; } 
    </style>
    <script type="text/javascript">
       dojo.require("dojo.parser");
       dojo.require("dijit.dijit");
       dojo.require("dijit.form.Form");
       dojo.require("dijit.form.Button");
       dojo.require("dijit.form.TextBox");       
       dojo.require("dojox.form.DropDownSelect");       
       dojo.require("dojox.layout.TableContainer"); 
       dojo.require("dojox.data.QueryReadStore");      
    </script>
</head>
<div dojoType="dojox.data.QueryReadStore" url="listItem.htm" jsId="comboStore"></div>

<div dojoType="dijit.form.Form" id="dataForm" jsId="dataForm" action="saveInventory.htm" method="post">
 
	<div dojoType="dojox.layout.TableContainer" cols="1" id="tc1" customClass="labelsAndValues">
    	<div dojoType="dijit.form.TextBox" title="Code:" id="code" name="code" onfocus="setOnClick();"></div>
    	<div dojoType="dijit.form.ComboBox" store="comboStore" title="Item:" name="itemid" id="item" searchAttr="Description" pageSize="100"></div>
	</div>
 	<button dojoType="dijit.form.Button" id="submitButton">Save It</button>
 	<button dojoType="dijit.form.Button"  onClick="dijit.byId('loadDiv').hide();" id="cancelButton">Cancel</button>
 </div>
<script type="text/javascript">
function setOnClick() {
	dojo.query('#submitButton').onclick( function(evt) {
	dojo.byId('response').innerHTML = 'Form being sent...';
	dojo.xhrPost({
	     form: "dataForm",
	     //handleAs: 'json',
	     load: function(data) {
	     	dojo.byId('response').innerHTML = data;
	     	dijit.byId("loadDiv").hide();
	     },
	     error: function(error) {
	      	dojo.byId('response').innerHTML = 'There is some error in submit';
	      }
	    }) // xhrPost()	
	   
	});
}	
</script>
